home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / Programming / MPW Interfaces & Libraries 3.1 / PInterfaces / Menus.p < prev    next >
Encoding:
Text File  |  1989-10-13  |  5.1 KB  |  183 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Wednesday, September 13, 1989 at 5:56 PM
  3.     Menus.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.     Copyright Apple Computer, Inc.    1985-1989
  7.     All rights reserved
  8. }
  9.  
  10.  
  11. {$IFC UNDEFINED UsingIncludes}
  12. {$SETC UsingIncludes := 0}
  13. {$ENDC}
  14.  
  15. {$IFC NOT UsingIncludes}
  16.     UNIT Menus;
  17.     INTERFACE
  18. {$ENDC}
  19.  
  20. {$IFC UNDEFINED UsingMenus}
  21. {$SETC UsingMenus := 1}
  22.  
  23. {$I+}
  24. {$SETC MenusIncludes := UsingIncludes}
  25. {$SETC UsingIncludes := 1}
  26. {$IFC UNDEFINED UsingQuickdraw}
  27. {$I $$Shell(PInterfaces)Quickdraw.p}
  28. {$ENDC}
  29. {$SETC UsingIncludes := MenusIncludes}
  30.  
  31. CONST
  32. noMark = 0;                         {mark symbol for MarkItem}
  33.  
  34. { menu defProc messages }
  35.  
  36. mDrawMsg = 0;
  37. mChooseMsg = 1;
  38. mSizeMsg = 2;
  39. textMenuProc = 0;
  40. hMenuCmd = 27;                        {itemCmd == 0x001B ==> hierarchical menu}
  41. hierMenu = -1;                        {a hierarchical menu - for InsertMenu call}
  42. mPopUpMsg = 3;                        {menu defProc messages - place yourself}
  43. mctAllItems = -98;                    {search for all Items for the given ID}
  44. mctLastIDIndic = -99;                {last color table entry has this in ID field}
  45.  
  46.  
  47. TYPE
  48.  
  49. MenuPtr = ^MenuInfo;
  50. MenuHandle = ^MenuPtr;
  51. MenuInfo = RECORD
  52.     menuID: INTEGER;
  53.     menuWidth: INTEGER;
  54.     menuHeight: INTEGER;
  55.     menuProc: Handle;
  56.     enableFlags: LONGINT;
  57.     menuData: Str255;
  58.     END;
  59.  
  60. MCEntryPtr = ^MCEntry;
  61. MCEntry = RECORD
  62.     mctID: INTEGER;                 {menu ID.  ID = 0 is the menu bar}
  63.     mctItem: INTEGER;                {menu Item. Item = 0 is a title}
  64.     mctRGB1: RGBColor;                {usage depends on ID and Item}
  65.     mctRGB2: RGBColor;                {usage depends on ID and Item}
  66.     mctRGB3: RGBColor;                {usage depends on ID and Item}
  67.     mctRGB4: RGBColor;                {usage depends on ID and Item}
  68.     mctReserved: INTEGER;            {reserved for internal use}
  69.     END;
  70.  
  71. MCTablePtr = ^MCTable;
  72. MCTableHandle = ^MCTablePtr;
  73.  
  74. MCTable = ARRAY [0..0] OF MCEntry;    { the entries themselves }
  75.  
  76. MenuCRsrcPtr = ^MenuCRsrc;
  77. MenuCRsrcHandle = ^MenuCRsrcPtr;
  78. MenuCRsrc = RECORD
  79.     numEntries: INTEGER;            {number of entries}
  80.     data: ARRAY [1..1] OF MCEntry;
  81.     END;
  82.  
  83.  
  84.  
  85. PROCEDURE InitMenus;
  86.     INLINE $A930;
  87. FUNCTION NewMenu(menuID: INTEGER;menuTitle: Str255): MenuHandle;
  88.     INLINE $A931;
  89. FUNCTION GetMenu(resourceID: INTEGER): MenuHandle;
  90.     INLINE $A9BF;
  91. PROCEDURE DisposeMenu(theMenu: MenuHandle);
  92.     INLINE $A932;
  93. PROCEDURE AppendMenu(menu: MenuHandle;data: Str255);
  94.     INLINE $A933;
  95. PROCEDURE AddResMenu(theMenu: MenuHandle;theType: ResType);
  96.     INLINE $A94D;
  97. PROCEDURE InsertResMenu(theMenu: MenuHandle;theType: ResType;afterItem: INTEGER);
  98.     INLINE $A951;
  99. PROCEDURE InsertMenu(theMenu: MenuHandle;beforeID: INTEGER);
  100.     INLINE $A935;
  101. PROCEDURE DrawMenuBar;
  102.     INLINE $A937;
  103. PROCEDURE DeleteMenu(menuID: INTEGER);
  104.     INLINE $A936;
  105. PROCEDURE ClearMenuBar;
  106.     INLINE $A934;
  107. FUNCTION GetNewMBar(menuBarID: INTEGER): Handle;
  108.     INLINE $A9C0;
  109. FUNCTION GetMenuBar: Handle;
  110.     INLINE $A93B;
  111. PROCEDURE SetMenuBar(menuList: Handle);
  112.     INLINE $A93C;
  113. PROCEDURE InsMenuItem(theMenu: MenuHandle;itemString: Str255;afterItem: INTEGER);
  114.     INLINE $A826;
  115. PROCEDURE DelMenuItem(theMenu: MenuHandle;item: INTEGER);
  116.     INLINE $A952;
  117. FUNCTION MenuKey(ch: CHAR): LONGINT;
  118.     INLINE $A93E;
  119. PROCEDURE HiliteMenu(menuID: INTEGER);
  120.     INLINE $A938;
  121. PROCEDURE SetItem(theMenu: MenuHandle;item: INTEGER;itemString: Str255);
  122.     INLINE $A947;
  123. PROCEDURE GetItem(theMenu: MenuHandle;item: INTEGER;VAR itemString: Str255);
  124.     INLINE $A946;
  125. PROCEDURE DisableItem(theMenu: MenuHandle;item: INTEGER);
  126.     INLINE $A93A;
  127. PROCEDURE EnableItem(theMenu: MenuHandle;item: INTEGER);
  128.     INLINE $A939;
  129. PROCEDURE CheckItem(theMenu: MenuHandle;item: INTEGER;checked: BOOLEAN);
  130.     INLINE $A945;
  131. PROCEDURE SetItemMark(theMenu: MenuHandle;item: INTEGER;markChar: CHAR);
  132.     INLINE $A944;
  133. PROCEDURE GetItemMark(theMenu: MenuHandle;item: INTEGER;VAR markChar: CHAR);
  134.     INLINE $A943;
  135. PROCEDURE SetItemIcon(theMenu: MenuHandle;item: INTEGER;icon: Byte);
  136.     INLINE $A940;
  137. PROCEDURE GetItemIcon(theMenu: MenuHandle;item: INTEGER;VAR iconNum: Byte);
  138.     INLINE $A93F;
  139. PROCEDURE SetItemStyle(theMenu: MenuHandle;item: INTEGER;chStyle: Style);
  140.     INLINE $A942;
  141. PROCEDURE GetItemStyle(theMenu: MenuHandle;item: INTEGER;VAR chStyle: Style);
  142. PROCEDURE CalcMenuSize(theMenu: MenuHandle);
  143.     INLINE $A948;
  144. FUNCTION CountMItems(theMenu: MenuHandle): INTEGER;
  145.     INLINE $A950;
  146. FUNCTION GetMHandle(menuID: INTEGER): MenuHandle;
  147.     INLINE $A949;
  148. PROCEDURE FlashMenuBar(menuID: INTEGER);
  149.     INLINE $A94C;
  150. PROCEDURE SetMenuFlash(count: INTEGER);
  151.     INLINE $A94A;
  152. FUNCTION MenuSelect(startPt: Point): LONGINT;
  153.     INLINE $A93D;
  154. PROCEDURE InitProcMenu(resID: INTEGER);
  155.     INLINE $A808;
  156. PROCEDURE GetItemCmd(theMenu: MenuHandle;item: INTEGER;VAR cmdChar: CHAR);
  157.     INLINE $A84E;
  158. PROCEDURE SetItemCmd(theMenu: MenuHandle;item: INTEGER;cmdChar: CHAR);
  159.     INLINE $A84F;
  160. FUNCTION PopUpMenuSelect(menu: MenuHandle;top: INTEGER;left: INTEGER;popUpItem: INTEGER): LONGINT;
  161.     INLINE $A80B;
  162. FUNCTION MenuChoice: LONGINT;
  163.     INLINE $AA66;
  164. PROCEDURE DelMCEntries(menuID: INTEGER;menuItem: INTEGER);
  165.     INLINE $AA60;
  166. FUNCTION GetMCInfo: MCTableHandle;
  167.     INLINE $AA61;
  168. PROCEDURE SetMCInfo(menuCTbl: MCTableHandle);
  169.     INLINE $AA62;
  170. PROCEDURE DispMCInfo(menuCTbl: MCTableHandle);
  171.     INLINE $AA63;
  172. FUNCTION GetMCEntry(menuID: INTEGER;menuItem: INTEGER): MCEntryPtr;
  173.     INLINE $AA64;
  174. PROCEDURE SetMCEntries(numEntries: INTEGER;menuCEntries: MCTablePtr);
  175.     INLINE $AA65;
  176.  
  177. {$ENDC}    { UsingMenus }
  178.  
  179. {$IFC NOT UsingIncludes}
  180.     END.
  181. {$ENDC}
  182.  
  183.